// vuex：状态管理，vuex数据是响应式的
import Vuex from 'vuex'
import Vue from 'vue'
import cart from './modules/cart.js'
import user from './modules/user.js'
import persistedstate from 'vuex-persistedstate'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    test: '我是vuex'
  },
  mutations: {},
  actions: {},
  getters: {},
  modules: {
    cart,
    user
  },
  plugins: [persistedstate({
    paths: ['cart.num', 'cart.cart', 'cart.address', 'user.token', 'user.userInfo'],
    "storage": {
      // "getItem":localStorage.getItem,
      "getItem": uni.getStorageSync,
      // localStorage.setItem,
      "setItem": uni.setStorageSync,
      // "removeItem": localStorage.removeItem
      "removeItem": uni.removeStorageSync
    }
  })]

})
export default store